<template xmlns="http://www.w3.org/1999/html">
    <!--新建-->
    <smart-form ref="form_create" method="POST" url="/sys/bulletin/info"
                 :on-succeed="onSubmit">
      <smart-form-layout require name="bulletinType" label="类型">
        <smart-select name="bulletinType" placeholder="类型" options="t_sys_bulletin.bulletin_type"></smart-select>
      </smart-form-layout>
      <smart-form-layout require name="bulletinTitle" label="标题">
        <smart-text-view name="bulletinTitle" placeholder="标题"></smart-text-view>
      </smart-form-layout>
      <smart-form-layout require name="bulletinOwner" label="所有者">
        <smart-text-view name="bulletinOwner" placeholder="所有者"></smart-text-view>
      </smart-form-layout>
      <smart-form-layout require name="gmtPublish" label="发布日期">
        <smart-date-picker name="gmtPublish" placeholder="发布日期"></smart-date-picker>
      </smart-form-layout>
      <smart-form-layout require name="content" label="内容">
        <smart-editor name="content" placeholder="内容"></smart-editor>
      </smart-form-layout>
    </smart-form>
</template>

<script>

/**
 * 操作面板
 */
export default {
    components: {}
    , props: {
        // 成功回调，通常是刷新数据表格
        onSucceed: {type: Function, default: undefined}
    }
    , data() {
        return {
            // 操作名称
            operation: undefined
        }
    }
    , methods: {
        /**
         * 新增/编辑操作成功，关闭当前窗口
         *
         * @param ret 后台响应数据
         */
        onSubmit: function (ret) {
            this.$refs.dialog.close();
            if (ret.code === 0) {
                this.$layers.succeed();
            }
            if (this.onSucceed !== undefined) {
                this.onSucceed(ret);
            }
        }
    }
}
</script>